#!/bin/bash 

numprocs=`ps ax | grep -c 'Xvfb \:2'` 

if [ $numprocs -eq 0 ]; then
  echo Oops, restarting Xvfb...
  /usr/X11R6/bin/Xvfb :2 1> /dev/null 2> /dev/null &
fi 
